<:!:/>
<!--
// @formatter:off
/**
 * @file c.registeruser.html
 * @author Alejandro Dario Simi
 * @date $Date: 2013-08-22 23:54:04 +0000 (Thu, 22 Aug 2013) $
 *
 * $Id: c.registeruser.html 103 2013-08-22 23:54:04Z daemonraco@gmail.com $
 * $URL: http://wcomix.googlecode.com/svn/tags/wcomix-1.0.0.1/themes/default/templates/contents/c.registeruser.html $
 */
// @formatter:on
--><::/><:ISSET:var=ACTIVATION:/><script type="text/javascript">
	ReloadHome();
</script><::/><:ISSET:!:var=ACTIVATION:/><script type="text/javascript">
	function RenewCaptcha() {
		$("#imgcaptcha").attr("src", "<:VAR:/>CAPTCHA-URI<::/>/securimage_show.php?" + Math.random());
		$("#CAPTCHA").val("");
	}
	function SignUp() {
		var username = $("#USERNAME").val().trim();
		var email = $("#EMAIL").val().trim();
		var password1 = $("#PASSWORD1").val().trim();
		var password2 = $("#PASSWORD2").val().trim();
		var captcha = $("#CAPTCHA").val();
		if(captcha.length > 0 && username.length > 0 && email.length > 0 && password1.length > 0 && password1 == password2) {
			jQuery.post("service.php?action=<:VAR:/>WC_SERVICE_USERS<::/>", {
				'MODE': 'register',
				'USERNAME': username,
				'EMAIL': email,
				'PASSWORD': password1,
				'CAPTCHA': captcha
			}, function(data) {
				var xml = $($.parseXML(data));
				if(xml.find("wc-success").length) {
					alert("An e-mail was sent to '" + email + "'.\nPlease check your e-mail inbox.");
					ReloadHome();
				} else if(xml.find("wc-failed").length) {
					var error = "";
					if(xml.find("wc-error>wc-code").length) {
						error = "[" + xml.find("wc-error>wc-code").text() + "] ";
					}
					error = error + xml.find("wc-error>wc-message").text();

					RenewCaptcha();
					alert("Failed: " + error);
				}
			});
		} else if(captcha.length == 0) {
			$("#CAPTCHA").focus();
			alert("You must complete the captcha with the right answer");
		} else if(username.length == 0) {
			$("#USERNAME").focus();
			alert("You must enter a username");
		} else if(password1.length == 0) {
			$("#PASSWORD1").focus();
			alert("You must enter a password");
		} else if(password2 != password1) {
			$("#PASSWORD2").focus();
			alert("Password retry doesn't match");
		} else {
			$("#EMAIL").focus();
			alert("You must enter an e-mail address");
		}
	}
</script>
<form id="UsernameForm" class="Formulary" action="#" onsubmit="SignUp();return false;" method="post">
	<table><tr>
		<td class="Title" colspan="2"><span class="Title">Sign Up</span></td>
	</tr><tr>
		<td class="Info" colspan="2"><p>
			This form will allow you to send a new user request.
		</p></td>
	</tr><tr>
		<td class="Label">e-mail</td>
		<td class="Value"><input class="Full" type="text" id="EMAIL" value=""/></td>
	</tr><tr>
		<td class="Label">Username</td>
		<td class="Value"><input class="Full" type="text" id="USERNAME" value=""/></td>
	</tr><tr>
		<td class="Label">Password</td>
		<td class="Value"><input class="Full" type="password" id="PASSWORD1" value=""/></td>
	</tr><tr>
		<td class="Label">Password Retry</td>
		<td class="Value"><input class="Full" type="password" id="PASSWORD2" value=""/></td>
	</tr><tr>
		<td class="Label" rowspan="3" style="vertical-align:top;">Captcha</td>
		<td class="Value" style="text-align:center;">
			<img id="imgcaptcha" class="center" src="<:VAR:/>CAPTCHA-URI<::/>/securimage_show.php" alt="CAPTCHA Image"/>
		</td>
	</tr><tr>
		<td class="Value">
			<input type="button" class="FullButton" value="Get another code" onclick="RenewCaptcha();return false;"/>
		</td>
	</tr><tr>
		<td class="Value">
			<input type="text" id="CAPTCHA" class="Full"/>
		</td>
	</tr><tr>
		<td colspan="2" class="Buttons">
			<input type="submit" value="Send"/>
		</td>
	</tr></table>
</form><::/>